import { ExtractPropTypes, PropType } from 'vue'

export type Color =
  | 'primary'
  | 'success'
  | 'warning'
  | 'danger'
  | 'info'
  | 'default';

export  type Shape = 'circle' |'round';

export type Size = 'small' | 'medium' | 'large';

export const buttonProps = {
    size:{ 
        type: String as PropType<Size>,
        default:'medium'
    },
    shape: {
        type: String as PropType<Shape>,
        default:''
    },
    icon: {
        type: String,
    },
    color: {
        type: String as PropType<Color>,
        validator: (val: string) => {
            return [
                'primary',
                'success',
                'warning',
                'danger',
                'info',
                'default',
                ''
            ].includes(val)
        },
        default: 'default'
    },
    
    plain:Boolean,
    round: Boolean,
    loading: Boolean,
    disabled: Boolean,
}

export const buttonEmits = {
    click: (e: MouseEvent) => e instanceof MouseEvent,
    mousedown: (e: MouseEvent) => e instanceof MouseEvent
}


export type ButtonProps = Partial<ExtractPropTypes<typeof buttonProps>>;